<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
<link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/jquery-easyui-1.3.3/themes/default/easyui.css">
<link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/jquery-easyui-1.3.3/themes/icon.css">
<link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath}/jquery-easyui-1.3.3/demo/demo.css">
<script type="text/javascript" src="${pageContext.request.contextPath}/jquery-easyui-1.3.3/jquery.min.js"></script>
<script type="text/javascript" src="${pageContext.request.contextPath}/jquery-easyui-1.3.3/jquery.easyui.min.js"></script>
<script type="text/javascript" src="${pageContext.request.contextPath}/jquery-easyui-1.3.3/locale/easyui-lang-zh_CN.js"></script>
<script type="text/javascript" src="${pageContext.request.contextPath}/js/uploadPreview.js"></script>
<script type="text/javascript" src="${pageContext.request.contextPath}/js/common.js"></script>
<script type="text/javascript" src="${pageContext.request.contextPath}/jquery-easyui-1.3.3/datagrid-detailview.js"></script>
 <script type="text/javascript">
        $(function(){
            $('#dg').datagrid({
                view: detailview,
                detailFormatter:function(index,row){
                    return '<div style="padding:2px;position:relative;"><table class="ddv"></table></div>';
                },
                onExpandRow: function(index,row){
                	console.log(row.fmechanism);
                    var ddv = $(this).datagrid('getRowDetail',index).find('table.ddv');
                    ddv.datagrid({
                    	url:'${pageContext.request.contextPath}/staff/getStaffByInstitution.action?fmechanism='+row.fmid+'&smechanism='+row.smid+'&tmechanism='+row.tmid,
                        fitColumns:true,
                        singleSelect:true,
                        rownumbers:true,
                        loadMsg:'',
                        height:'auto',
                        columns:[[
                        	{field:'name',title:'姓名',width:80,align:'center',sortable:true}, 
                        	{field:'item1',title:'基本工资',width:100,align:'center',sortable:true}, 
                        	{field:'item2',title:'养老保险',width:80,align:'center',sortable:true}, 
                        	{field:'item3',title:'医疗保险',width:80,align:'center',sortable:true}, 
                        	{field:'item4',title:'失业保险',width:150,align:'center',sortable:true}, 
                        	{field:'item5',title:'住房公积金',width:60,align:'center',sortable:true},
                        	{field:'item6',title:'其他',width:60,align:'center',sortable:true}
                        ]],
                        onResize:function(){
                            $('#dg').datagrid('fixDetailRowHeight',index);
                        },
                        onLoadSuccess:function(){
                            setTimeout(function(){
                                $('#dg').datagrid('fixDetailRowHeight',index);
                            },0);
                        }
                    });
                    $('#dg').datagrid('fixDetailRowHeight',index);
                }
            });
        });
        
        
        function openlookDialog(){
    		var selectedRows=$("#dg").datagrid('getSelections');
    		//var getSelected=$("#dg").datagrid('getSelected');
    		
    		//alert(getSelected.name);
    		if(selectedRows.length!=1){
    			$.messager.alert("系统提示","请选择一条要查看的数据！");
    			return;
    		}
    		var row=selectedRows[0];
    		console.log(row.fmechanism);
    		console.log(row.name);
    		//alert(row.fmechanism);
    		//alert(row.name);
    		
    	}
    </script>
</head>
<body style="margin:1px;">
    <table id="dg" fit="true"  url="${pageContext.request.contextPath}/staff/findEntry.action" class="easyui-datagrid"
   		 title="薪酬发放管理"  toolbar="#tb" singleSelect="true" fitColumns="true" >
        <thead>
            <tr>
                <th field="fmechanism" align="center" width="80">一级机构</th>
                <th field="smechanism" align="center" width="100">二级机构</th>
                <th field="tmechanism" align="center" width="80">三级机构</th>
                <th field="number" align="center" width="80">人数</th>
                <th field="total" align="center" width="80" >基本薪酬总额</th>
            </tr>
        </thead>
    </table>
   <div id="tb">
	 <div>
			<a href="javascript:openModifyDialog()" class="easyui-linkbutton" iconCls="icon-edit" plain="true">复核薪酬标准</a>
			<a href="javascript:openlookDialog()" class="easyui-linkbutton" iconCls="icon-tip" plain="true">查看详细</a>
		</div>
		<div>
		
			<a href="javascript:search()" class="easyui-linkbutton" iconCls="icon-search" plain="true">搜索</a>
		</div>
	</div>
    
    
</body>
</html>